<?php
namespace app\admin\validate;

use think\Validate;

class ConfigValidate extends Validate
{
    protected $rule = [
        'name' =>  'require|unique:Config',
        'title' => 'require',
        'value' => 'require',
        "id" => 'require',
        "sort"=>'require|number',
        "status" => 'require|in:1,-1',
    ];

    protected $message = [
        'name.require' => '分类名称必须填写',
        'title.require' => '名称必须填写',
        'value.require' => '配置值必须填写',
        "id.require" => "缺少id",
        "sort.require"=>"排序必须填写",
        "sort.number"=>"排序必须是数字",
        "status.in" => "状态值错误",
        "status" => "缺少状态值"
    ];

    protected $scene = [
        'add' => ['name','sort',"title","value"],
        'edit' => ['name','id','sort',"title","value"],
        'status'=>['id','status'],
    ];
}